The document object model in Dreamweaver

A browser's DOM determines how the JavaScript in an HTML document works in that browser. Similarly, Dreamweaver's DOM determines how the JavaScript in extensions works in Dreamweaver.

Dreamweaver's DOM combines a subset of the Netscape Navigator 4.0 DOM with a subset of the World Wide Web Consortium (W3C)'s DOM Level 1. With the incorporation of DOM Level 1, every part of an HTML page has become an object—including tags (which the W3C calls elements), comments, and text.

Objects can be referred to by index (document.forms[3].elements[1]) or by name (document.myForm.myButton). Objects with the same name are collapsed into an array. You can access a particular object in the group by index (for example, the first radio button with the name myRadioGroup in myForm would be referenced as document.myForm.myRadioGroup[0]).

The following table gives an overview of the properties, methods, and events supported by each object; these are described in more detail in books such as JavaScript: The Definitive Guide (O'Reilly). Additional details about the W3C properties and methods, which are less thoroughly documented by third parties, follow the table. A bullet (·) marks read-only properties.

Object Properties Methods Events

window

document ·

navigator ·

innerWidth ·

innerHeight ·

screenX ·

screenY ·

alert()

confirm()

escape()

unescape()

close()

setTimeout()

clearTimeout()

setInterval()

clearInterval()

resizeTo()

onResize

navigator

platform ·

None

None

document

forms · (an array of form objects)

images · (an array of image objects)

layers · (an array of LAYER, ILAYER, and absolutely positioned DIV and SPAN objects)

child objects by name ·

nodeType ·

parentNode ·

childNodes ·

documentElement ·

body ·

URL ·

parentWindow ·

getElementsByTagName()

hasChildNodes()

onLoad

all tags/elements

nodeType ·

parentNode ·

childNodes ·

tagName ·

attributes by name

innerHTML

outerHTML

getAttribute()

setAttribute()

removeAttribute()

getElementsByTagName()

hasChildNodes()

form

In addition to the properties available for all tags:

elements · (an array of button, checkbox, password, radio, reset, select, submit, text, file, hidden, image, and textarea objects)

child objects by name ·

Only those methods available to all tags.

None

layer

In addition to the properties available for all tags:

visibility

left

top

width

height

zIndex

Only those methods available to all tags.

None

image

In addition to the properties available for all tags:

src

Only those methods available to all tags.

onMouseOver

onMouseOut

onMouseDown

onMouseUp

button

reset

submit

In addition to the properties available for all tags:

form ·

In addition to the methods available for all tags:

blur()

focus()

onClick

checkbox

radio

In addition to the properties available for all tags:

checked

form ·

In addition to the methods available for all tags:

blur()

focus()

onClick

password

text

file

hidden

image (field)

textarea

In addition to the properties available for all tags:

form ·

value

In addition to the methods available for all tags:

blur()

focus()

select()

onBlur

onFocus

select

In addition to the properties available for all tags:

form ·

options · (an array of option objects)

selectedIndex

In addition to the methods available for all tags:

blur() (Windows only)

focus() (Windows only)

onBlur (Windows only)

onChange

onFocus (Windows only)

option

In addition to the properties available for all tags:

text

Only those methods available to all tags.

None

array

boolean

date

function

math

number

object

string

regexp

Matches Netscape 4

Matches Netscape 4

None

text

nodeType ·

parentNode ·

childNodes ·

data

hasChildNodes()

None

comment

nodeType ·

parentNode ·

childNodes ·

data

hasChildNodes()

None

nodelist

length ·

item()

None


While Dreamweaver has a DOM that resembles that of a browser, the property inspectors, floating palettes, and parameters and options dialog boxes associated with extensions are not browsers. For this reason, links (A tags) are not supported. In addition, while live plugins (set to play at all times) are supported in the BODY of extensions, Java applets and ActiveX controls are not.